<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
<title>DynamoRIO API: dr_ir_instrlist.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">DynamoRIO API
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dr__ir__instrlist_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">dr_ir_instrlist.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Functions to create and manipulate lists of instructions.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a53470097e44fe65dd02df98e154df0fe"><td class="memItemLeft" align="right" valign="top">instrlist_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a53470097e44fe65dd02df98e154df0fe">instrlist_create</a> (void *drcontext)</td></tr>
<tr class="memitem:a58f6c047c08e09d681dfcc6e35a0ef19"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a58f6c047c08e09d681dfcc6e35a0ef19">instrlist_init</a> (instrlist_t *ilist)</td></tr>
<tr class="memitem:ad2cf3084b7f2147bf17f007b8fead468"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ad2cf3084b7f2147bf17f007b8fead468">instrlist_destroy</a> (void *drcontext, instrlist_t *ilist)</td></tr>
<tr class="memitem:a718a7c4da5397acc68fa87c7aaff63cc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a718a7c4da5397acc68fa87c7aaff63cc">instrlist_clear</a> (void *drcontext, instrlist_t *ilist)</td></tr>
<tr class="memitem:aeee3af7ee64fce9115e03ca55fa80a0f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#aeee3af7ee64fce9115e03ca55fa80a0f">instrlist_clear_and_destroy</a> (void *drcontext, instrlist_t *ilist)</td></tr>
<tr class="memitem:ae0f71aa213fbbf097e13a67042af52f0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ae0f71aa213fbbf097e13a67042af52f0">instrlist_set_translation_target</a> (instrlist_t *ilist, app_pc pc)</td></tr>
<tr class="memitem:a18ae2e4d759afc814d47a52073bea348"><td class="memItemLeft" align="right" valign="top">app_pc&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a18ae2e4d759afc814d47a52073bea348">instrlist_get_translation_target</a> (instrlist_t *ilist)</td></tr>
<tr class="memitem:ac9a47c1b7376ca06d8dcb4b3094e5a67"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ac9a47c1b7376ca06d8dcb4b3094e5a67">instrlist_first</a> (instrlist_t *ilist)</td></tr>
<tr class="memitem:a7facdfdbc94dff0029e1c7a0be55a934"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a7facdfdbc94dff0029e1c7a0be55a934">instrlist_first_app</a> (instrlist_t *ilist)</td></tr>
<tr class="memitem:ae2f37fe5e485b5aed7a196a5a1348d4a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ae2f37fe5e485b5aed7a196a5a1348d4a">instrlist_last</a> (instrlist_t *ilist)</td></tr>
<tr class="memitem:a5b665b4bd8c54359b2a57e0f2e46ff5d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a5b665b4bd8c54359b2a57e0f2e46ff5d">instrlist_append</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *instr)</td></tr>
<tr class="memitem:a26415c0663dede10a65a6111110206ab"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a26415c0663dede10a65a6111110206ab">instrlist_prepend</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *instr)</td></tr>
<tr class="memitem:a97153b3ccbb7282beb3a7c16622f40fa"><td class="memItemLeft" align="right" valign="top">instrlist_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a97153b3ccbb7282beb3a7c16622f40fa">instrlist_clone</a> (void *drcontext, instrlist_t *old)</td></tr>
<tr class="memitem:a9c82c8b76c549a10ae88fa63eb85aa5b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a9c82c8b76c549a10ae88fa63eb85aa5b">instrlist_preinsert</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *where, <a class="el" href="structinstr__t.html">instr_t</a> *instr)</td></tr>
<tr class="memitem:ab98cd7319abad8ff223b00fb6f5c5bf8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ab98cd7319abad8ff223b00fb6f5c5bf8">instrlist_postinsert</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *where, <a class="el" href="structinstr__t.html">instr_t</a> *instr)</td></tr>
<tr class="memitem:a9bd1a00391f4ad909f67a31ea9163962"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a9bd1a00391f4ad909f67a31ea9163962">instrlist_replace</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *oldinst, <a class="el" href="structinstr__t.html">instr_t</a> *newinst)</td></tr>
<tr class="memitem:a2bad28eed64877354dcf984ff672c7d9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a2bad28eed64877354dcf984ff672c7d9">instrlist_remove</a> (instrlist_t *ilist, <a class="el" href="structinstr__t.html">instr_t</a> *instr)</td></tr>
<tr class="memitem:a24c81467322f6eb86a8652ab1000fd2a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a24c81467322f6eb86a8652ab1000fd2a">instrlist_set_fall_through_target</a> (instrlist_t *bb, app_pc tgt)</td></tr>
<tr class="memitem:a71b0819b01546ec1b69063ba189a613e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a71b0819b01546ec1b69063ba189a613e">instrlist_set_return_target</a> (instrlist_t *bb, app_pc tgt)</td></tr>
<tr class="memitem:aaac5ae2bc9af179b56bbbe5efc14e8b5"><td class="memItemLeft" align="right" valign="top">byte *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#aaac5ae2bc9af179b56bbbe5efc14e8b5">instrlist_encode</a> (void *drcontext, instrlist_t *ilist, byte *pc, bool has_instr_jmp_targets)</td></tr>
<tr class="memitem:a8ae48a113e137b95cd3499f9fa57f5ea"><td class="memItemLeft" align="right" valign="top">byte *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#a8ae48a113e137b95cd3499f9fa57f5ea">instrlist_encode_to_copy</a> (void *drcontext, instrlist_t *ilist, byte *copy_pc, byte *final_pc, byte *max_pc, bool has_instr_jmp_targets)</td></tr>
<tr class="memitem:ae8313ff5985340de519dfe4cc7555c60"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dr__ir__instrlist_8h.html#ae8313ff5985340de519dfe4cc7555c60">instrlist_disassemble</a> (void *drcontext, app_pc tag, instrlist_t *ilist, file_t outfile)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Functions to create and manipulate lists of instructions. </p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a5b665b4bd8c54359b2a57e0f2e46ff5d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_append </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>instr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Adds <code>instr</code> to the end of <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="a718a7c4da5397acc68fa87c7aaff63cc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_clear </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Frees the instructions in <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="aeee3af7ee64fce9115e03ca55fa80a0f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_clear_and_destroy </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Destroys the instructions in <code>ilist</code> and destroys the instrlist_t object itself. </p>

</div>
</div>
<a class="anchor" id="a97153b3ccbb7282beb3a7c16622f40fa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">instrlist_t* instrlist_clone </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>old</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Allocates a new instrlist_t and for each <a class="el" href="structinstr__t.html">instr_t</a> in <code>old</code> allocates a new <a class="el" href="structinstr__t.html">instr_t</a> using instr_clone to produce a complete copy of <code>old</code>. Each operand that is <a class="el" href="dr__ir__opnd_8h.html#aa278662a54e9df9de5f06c30e53d7596">opnd_is_instr()</a> has its target updated to point to the corresponding <a class="el" href="structinstr__t.html">instr_t</a> in the new instrlist_t (this routine assumes that all such targets are contained within <code>old</code>, and may fault otherwise). </p>

</div>
</div>
<a class="anchor" id="a53470097e44fe65dd02df98e154df0fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">instrlist_t* instrlist_create </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns an initialized instrlist_t allocated on the thread-local heap. </p>

</div>
</div>
<a class="anchor" id="ad2cf3084b7f2147bf17f007b8fead468"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_destroy </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Deallocates the thread-local heap storage for <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="ae8313ff5985340de519dfe4cc7555c60"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_disassemble </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">app_pc&#160;</td>
          <td class="paramname"><em>tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">file_t&#160;</td>
          <td class="paramname"><em>outfile</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Prints each instruction in <code>ilist</code> in sequence to <code>outfile</code>. The default is to use AT&amp;T-style syntax, unless the <a class="el" href="using.html#op_syntax_intel">-syntax_intel</a> runtime option is specified. </p>

</div>
</div>
<a class="anchor" id="aaac5ae2bc9af179b56bbbe5efc14e8b5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">byte* instrlist_encode </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">byte *&#160;</td>
          <td class="paramname"><em>pc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>has_instr_jmp_targets</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Encodes each instruction in <code>ilist</code> in turn in contiguous memory starting at <code>pc</code>. Returns the pc after all of the encodings, or NULL if any one of the encodings failed. Uses the x86/x64 mode stored in each instr, not the mode of the current thread. In order for <a class="el" href="structinstr__t.html">instr_t</a> operands to be encoded properly, <code>has_instr_jmp_targets</code> must be true. If <code>has_instr_jmp_targets</code> is true, the note field of each <a class="el" href="structinstr__t.html">instr_t</a> in ilist will be overwritten, and if any <a class="el" href="structinstr__t.html">instr_t</a> targets are not in <code>ilist</code>, they must have their note fields set with their offsets relative to pc. x86 instructions can occupy up to 17 bytes each, so the caller should ensure the target location has enough room to avoid overflow. </p>

</div>
</div>
<a class="anchor" id="a8ae48a113e137b95cd3499f9fa57f5ea"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">byte* instrlist_encode_to_copy </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>drcontext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">byte *&#160;</td>
          <td class="paramname"><em>copy_pc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">byte *&#160;</td>
          <td class="paramname"><em>final_pc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">byte *&#160;</td>
          <td class="paramname"><em>max_pc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>has_instr_jmp_targets</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Encodes each instruction in <code>ilist</code> in turn in contiguous memory starting <code>copy_pc</code> in preparation for copying to <code>final_pc</code>. Any pc-relative instruction is encoded as though the instruction list were located at <code>final_pc</code>. This allows for direct copying of the encoded bytes to <code>final_pc</code> without re-relativization.</p>
<p>Returns the pc after all of the encodings, or NULL if any one of the encodings failed.</p>
<p>Uses the x86/x64 mode stored in each instr, not the mode of the current thread.</p>
<p>In order for <a class="el" href="structinstr__t.html">instr_t</a> operands to be encoded properly, <code>has_instr_jmp_targets</code> must be true. If <code>has_instr_jmp_targets</code> is true, the note field of each <a class="el" href="structinstr__t.html">instr_t</a> in ilist will be overwritten, and if any <a class="el" href="structinstr__t.html">instr_t</a> targets are not in <code>ilist</code>, they must have their note fields set with their offsets relative to pc.</p>
<p>If <code>max_pc</code> is non-NULL, computes the total size required to encode the instruction list before performing any encoding. If the whole list will not fit starting at <code>copy_pc</code> without exceeding <code>max_pc</code>, returns NULL without encoding anything. Otherwise encodes as normal. Note that x86 instructions can occupy up to 17 bytes each, so if <code>max_pc</code> is NULL, the caller should ensure the target location has enough room to avoid overflow. </p>

</div>
</div>
<a class="anchor" id="ac9a47c1b7376ca06d8dcb4b3094e5a67"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structinstr__t.html">instr_t</a>* instrlist_first </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the first <a class="el" href="structinstr__t.html">instr_t</a> in <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="a7facdfdbc94dff0029e1c7a0be55a934"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structinstr__t.html">instr_t</a>* instrlist_first_app </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the first application (non-meta) instruction in the instruction list <code>ilist</code>.</p>
<dl class="section note"><dt>Note:</dt><dd>All preceding meta instructions will be skipped.</dd>
<dd>
We do recommend using this routine during the phase of application code analysis, as any non-app instructions present are guaranteed to be ok to skip. However, the caution should be exercised if using this routine after any instrumentation insertion has already happened, as instrumentation might affect register usage or other factors being analyzed. </dd></dl>

</div>
</div>
<a class="anchor" id="a18ae2e4d759afc814d47a52073bea348"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">app_pc instrlist_get_translation_target </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the translation target, or NULL if none is set. </p>

</div>
</div>
<a class="anchor" id="a58f6c047c08e09d681dfcc6e35a0ef19"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_init </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initializes <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="ae2f37fe5e485b5aed7a196a5a1348d4a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structinstr__t.html">instr_t</a>* instrlist_last </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the last <a class="el" href="structinstr__t.html">instr_t</a> in <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="ab98cd7319abad8ff223b00fb6f5c5bf8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_postinsert </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>where</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>instr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Inserts <code>instr</code> into <code>ilist</code> after <code>where</code>. </p>

</div>
</div>
<a class="anchor" id="a9c82c8b76c549a10ae88fa63eb85aa5b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_preinsert </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>where</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>instr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Inserts <code>instr</code> into <code>ilist</code> prior to <code>where</code>. </p>

</div>
</div>
<a class="anchor" id="a26415c0663dede10a65a6111110206ab"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_prepend </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>instr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Adds <code>instr</code> to the front of <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="a2bad28eed64877354dcf984ff672c7d9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_remove </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>instr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Removes (does not destroy) <code>instr</code> from <code>ilist</code>. </p>

</div>
</div>
<a class="anchor" id="a9bd1a00391f4ad909f67a31ea9163962"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structinstr__t.html">instr_t</a>* instrlist_replace </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>oldinst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structinstr__t.html">instr_t</a> *&#160;</td>
          <td class="paramname"><em>newinst</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Replaces <code>oldinst</code> with <code>newinst</code> in <code>ilist</code> (does not destroy <code>oldinst</code>). </p>

</div>
</div>
<a class="anchor" id="a24c81467322f6eb86a8652ab1000fd2a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool instrlist_set_fall_through_target </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>bb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">app_pc&#160;</td>
          <td class="paramname"><em>tgt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Specifies the fall-through target of a basic block if its last instruction is a conditional branch instruction. It can only be called in basic block building event callbacks when the <code>for_trace</code> parameter is false, and has NO EFFECT in other cases. </p>

</div>
</div>
<a class="anchor" id="a71b0819b01546ec1b69063ba189a613e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool instrlist_set_return_target </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>bb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">app_pc&#160;</td>
          <td class="paramname"><em>tgt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Specifies the return target of a basic block if its last instruction is a call instruction. It can only be called in basic block building event callbacks when the <code>for_trace</code> parameter is false, and has NO EFFECT in other cases. </p>

</div>
</div>
<a class="anchor" id="ae0f71aa213fbbf097e13a67042af52f0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void instrlist_set_translation_target </td>
          <td>(</td>
          <td class="paramtype">instrlist_t *&#160;</td>
          <td class="paramname"><em>ilist</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">app_pc&#160;</td>
          <td class="paramname"><em>pc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>All future instructions inserted into <code>ilist</code> that do not have raw bits will have <a class="el" href="dr__ir__instr_8h.html#af1beda2d570ba04d74ca9cbd7c31bb1d">instr_set_translation()</a> called with <code>pc</code> as the target. This is a convenience routine to make it easy to have the same code generate non-translation and translation instructions, and it does not try to enforce that all instructions have translations (e.g., some could be inserted via <a class="el" href="dr__ir__instr_8h.html#aa8c3ae1eb25b05c337889022f35e6187">instr_set_next()</a>). </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_3f960cec7fb648840e8ab2c814e874ae.html">include</a></li><li class="navelem"><a class="el" href="dr__ir__instrlist_8h.html">dr_ir_instrlist.h</a></li>
    <li class="footer" style="float:none;text-align:center"><img border=0 src="favicon.png"> &nbsp;  DynamoRIO API version 5.0.0 --- Wed Sep 10 2014 21:36:43 &nbsp; <img border=0 src="favicon.png">
</small></address>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>
